/**
	@file   StringTrim.h
	@date   2010/09/08
	@author sang-soo kim
	@brief  StringTrim class.
*/


#if  !defined(__STRING_TRIM_H__)
#define __STRING_TRIM_H__
//#pragma once

#include <iostream>
#include <string>

class StringTrim
{
public:
	static inline std::string left(const std::string& str) 
	{
		int n = str.find_first_not_of(" \t\v\n");
		if( n < 0 ) return "";
		return n == (int)std::string::npos ? str : str.substr(n, str.length()); 
	}
	static inline std::string right(const std::string& str) 
	{
		int n = str.find_last_not_of(" \t\v\n"); 
		if( n < 0 ) return "";
		return n == (int)std::string::npos ? str : str.substr(0, n + 1);
	}
	static inline std::string trim( const std::string& str)
	{
		return left(right(str));
	}
};

#endif


